var t = require("../../@babel/runtime/helpers/defineProperty"),
  a = require("../../res/www.a9a.cn.js"),
  i = getApp();
Page({
  data: {
    nTitle: "推广中心",
    btm_nav: "index",
    btmnavbg_color: "#B8BCCC",
    btmnavbg_rgbcolor: a.c16_rgb("#B8BCCC"),
    triggered: !0,
    loading_flag: !1,
    loading_ico_flag: !1,
    loading_str: "玩命加载中",
  },
  onLoad: function (t) {
    var e = this,
      n = 0,
      o = 0;
    wx.setNavigationBarTitle({ title: e.data.nTitle }),
      i.get_config("_ZEAI").then(function (t) {
        e.setData({
          color: i._ZEAI.color,
          rgbcolor: a.c16_rgb(i._ZEAI.color),
          WWW: i.WWW,
        });
      }),
      i.get_navigationBarTopHeight(e),
      (a.ifint(t.tguid) || a.ifint(t.admid)) &&
        ((n = a.ifint(t.tguid) ? t.tguid : 0),
        (o = a.ifint(t.admid) ? t.admid : 0)),
      e.setData({ tguid: n, admid: o }),
      this.init();
  },
  init: function () {
    var t = this;
    wx.showLoading({ title: "玩命加载中...", mask: !0 }), !1;
    var e = {
      submitok: "INDEX",
      openid: wx.getStorageSync("COOK_U").openid,
      tguid: t.data.tguid,
      admid: t.data.admid,
    };
    i.ajax({
      url: "tg.php",
      data: e,
      success: function (i) {
        wx.hideLoading(),
          1 == i.flag
            ? (wx.setNavigationBarTitle({ title: i.nTitle }),
              t.setData({
                nTitle: i.nTitle,
                btm_nav_msg_num: i.btm_nav_msg_num,
                cook_tg_id: i.D.cook_tg_id,
                cook_tg_flag: i.D.cook_tg_flag,
                MB: i.MB,
                BANG: i.BANG,
                STEP: i.STEP,
                SHARE: i.SHARE,
                flag: i.flag,
              }))
            : (t.setData({ flag: i.flag }),
              (i.this = t),
              (i.url = "no"),
              a.sorry(i));
      },
    });
  },
  tghbFn: function () {
    a.empty(this.data.MB) || i.openSetting(this.data.MB),
      1 == this.data.cook_tg_flag
        ? wx.navigateTo({
            url:
              "my_ewm?tguid=" +
              this.data.cook_tg_id +
              "&admid=" +
              this.data.admid,
          })
        : wx.redirectTo({
            url: "my?tguid=" + this.data.tguid + "&admid=" + this.data.admid,
          });
  },
  onPullDownRefresh: function () {
    var t = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        t.setData({
          triggered: !1,
          loading_flag: !1,
          loading_str: "拼命加载中",
          LIST: [],
          nodata: !1,
          t: 0,
          keyword: "",
        }),
          t.setloading("end", "拼命加载中"),
          2,
          {},
          t.init();
      }, 500);
  },
  setloading: function (t, a) {
    "start" == t
      ? this.setData({ loading_flag: !0, loading_ico_flag: !0, loading_str: a })
      : this.setData({
          loading_flag: !1,
          loading_ico_flag: !1,
          loading_str: a,
        });
  },
  binnd_scroll: function (t) {
    t.detail.scrollTop > 100
      ? this.setData({ backtop_flag: !0 })
      : this.setData({ backtop_flag: !1 });
  },
  backtopFn: function (a) {
    var i = "scrolltopNum_" + a.currentTarget.dataset.id;
    this.setData(t({}, i, 0));
  },
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      path: "/pages/tg/index",
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      query: "",
      path: "/pages/tg/index",
    };
  },
});
